package com.jic.member.controller.manage;

import com.jic.common.base.vo.Page;
import com.jic.common.base.vo.PageResult;
import com.jic.common.base.vo.RestResult;
import com.jic.member.common.util.BeanUtil;
import com.jic.member.entity.DisCommissionInfo;
import com.jic.member.request.DisCommissionInfoRequest;
import com.jic.member.service.DisCommissionInfoService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@ApiOperation(value = "查询佣金明细controller")
@RestController
@RequestMapping("/disCommission")
@Slf4j
public class DisCommissionController {
    @Autowired
    private DisCommissionInfoService disCommissionInfoService;
    /*
     * 分页查询
     * */
    @ApiOperation(value = "获取查询佣金列表")
    @ResponseBody
    @RequestMapping("/queryCommissionListPage")
    public RestResult<PageResult<DisCommissionInfo>> queryCommissionListPage(@RequestBody DisCommissionInfoRequest form) {
        log.info("开始进入会员积分流水列表=========》,{}", form.toString());
        Page page = new Page();
        page.setLimit(form.getLimit());
        page.setStart(form.getStart());
        DisCommissionInfo memberRequest = BeanUtil.copy(form, DisCommissionInfo.class);
        PageResult<DisCommissionInfo> result = disCommissionInfoService.queryPage(memberRequest, page);
        return RestResult.success(result);
    }
}
